package cn.stylefeng.guns.sys.modular.api.controller;

import cn.stylefeng.guns.sys.core.upay.response.DefaultUmsClient;
import cn.stylefeng.guns.sys.core.upay.response.UpayClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

/**
 * @author zhou
 * Date: 2019-7-30 13:53:28
 */
public class BaseOperate {

    protected static final Logger logger = LoggerFactory.getLogger(BaseOperate.class);

    public static UpayClient client = new DefaultUmsClient();

    /**
     * 从密钥文件中读取密钥
     *
     * @param fileName
     * @return
     */
    public static String getKey(String fileName) {
        try {
            BufferedReader br = new BufferedReader(new FileReader(fileName));

            String line;
            StringBuilder sbtr = new StringBuilder();
            while ((line = br.readLine()) != null) {
                sbtr.append(line);
            }
            return sbtr.toString();
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
}
